package com.netintech.intelligenceInterface.iflytek.controller;

import com.netintech.intelligenceInterface.iflytek.domain.textIngredientExtract.TextIngredientExtractParam;
import com.netintech.intelligenceInterface.iflytek.util.HeadersUtil;
import com.netintech.intelligenceInterface.iflytek.util.RestTemplateUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpEntity;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.client.RestTemplate;

import static com.netintech.intelligenceInterface.common.StaticBean.URL1;

/**
 * @author lining
 * @date 2021/4/27 16:09
 * 文本要素抽取接口
 */
@RestController
public class TextIngredientExtractController {

    private static final String TEXT_INGREDIENT_EXTRACT_URL = "/tuling/elle/v2/interpret/";

    @PostMapping("/textIngredientExtract")
    public String textIngredientExtract(@RequestBody TextIngredientExtractParam param) {
        String url = URL1 + TEXT_INGREDIENT_EXTRACT_URL;
        return RestTemplateUtil.getRestTemplateResult(url, param);
    }

    @PostMapping("/test/textIngredientExtract")
    public String textIngredientExtractTest(@RequestBody TextIngredientExtractParam param) {
        String url = URL1 + TEXT_INGREDIENT_EXTRACT_URL;
        return RestTemplateUtil.getRestTemplateResult(url, param);
    }

}
